package com.example.onlineeducation.data.model

import android.os.Parcelable
import androidx.recyclerview.widget.DiffUtil
import com.example.onlineeducation.data.entity.FileEntitiy
import kotlinx.android.parcel.Parcelize

@Parcelize
data class OfflineExamRecordDataModel(
    val id: String?,
    val avatar: String,//头像
    val userName: String,//姓名
    val workType: String,//工种类型
    val state: String,//考试结果状态（0-未通过，1-已通过，-1=未考试）
    val examScores: String?,//考试分数
    val answerTime: Int?,//答题时长
    val examDate: String?,//考试日期
    val groupName: String,//班组名
    val webPathList: List<FileEntitiy>?,//卷面图
) : Parcelable {
    companion object {
        val diffCallback = object : DiffUtil.ItemCallback<OfflineExamRecordDataModel>() {
            override fun areItemsTheSame(
                oldItem: OfflineExamRecordDataModel,
                newItem: OfflineExamRecordDataModel
            ): Boolean {
                return oldItem.id == newItem.id
            }

            override fun areContentsTheSame(
                oldItem: OfflineExamRecordDataModel,
                newItem: OfflineExamRecordDataModel
            ): Boolean {
                return oldItem.id == newItem.id
                        && oldItem.avatar == newItem.avatar
                        && oldItem.userName == newItem.userName
                        && oldItem.workType == newItem.workType
                        && oldItem.state == newItem.state
                        && oldItem.examScores == newItem.examScores
                        && oldItem.answerTime == newItem.answerTime
                        && oldItem.examDate == newItem.examDate
                        && oldItem.groupName == newItem.groupName
                        && oldItem.webPathList == newItem.webPathList
            }
        }
    }
}